import 'package:demo/theme/app_text_theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:get/get.dart';

import '../../../../theme/app_colors.dart';
import 'order_detail_controller.dart';

class OrderDetailView extends GetView<OrderDetailController> {
  const OrderDetailView({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {

    return Scaffold(
      backgroundColor: Color_bg,
      // appBar: AppBar(
      //   backgroundColor: controller.titleBgColor.value,
      //   title: Text(controller.titleStr.value,style: text_title_white),
      //   iconTheme: const IconThemeData(color: Color_white),
      // ),
      body: Column(children: [
        Obx(() => AppBar(
          backgroundColor: controller.titleBgColor.value,
          title: Text(controller.titleStr.value,style: text_title_white),
          iconTheme: const IconThemeData(color: Color_white),
        )),
        SizedBox(height: 15.w),
        buildTopWidget(),
        SizedBox(height: 30.w),
        buildBottomWidget(),
        SizedBox(height: 15.w),
      ]),
    );
  }

  Widget buildTopWidget(){
    return Container(
      width: Get.width - 30.w,
      margin: EdgeInsets.symmetric(horizontal: 15.w),
      padding: EdgeInsets.symmetric(horizontal: 15.w),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(6.w),
        color: Color_white,
      ),
      child: Column(
        crossAxisAlignment : CrossAxisAlignment.start,
        children: [
          // SizedBox(height: 15.w),
          // Row(children: [
          //   SizedBox(width: 15.w),
          //   Container(width: 23.w,height: 23.w,color: Colors.deepPurple),
          //   SizedBox(width: 6.w),
          //   Text('大神大',style: text_131732_16),
          //   SizedBox(width: 15.w)
          // ]),
          SizedBox(height: 15.w),
          Obx(() => Text(controller.hint1Str.value,style: text_131732_14)),
          SizedBox(height: 3.w),
          Obx(() => Text(controller.hint2Str.value,style: text_grey_12)),
          SizedBox(height: 15.w),
          Row(
            mainAxisAlignment : MainAxisAlignment.spaceBetween,
            children: [
              Obx(() => Text(controller.applyMoney.value,style: text_131732_14)),
              Obx(() => Text(controller.applyTerm.value,style: text_131732_14)),
          ]),
          SizedBox(height: 30.w),
          Stack(children: [
            Obx(() => Row(
              mainAxisAlignment : MainAxisAlignment.spaceBetween,
              children: [
                Container(
                  width: 8.w,
                  height: 8.w,
                  decoration: BoxDecoration(
                    shape: BoxShape.circle,
                    color: controller.dot1Color.value,
                  ),
                ),
                Container(
                  width: 8.w,
                  height: 8.w,
                  decoration: BoxDecoration(
                    shape: BoxShape.circle,
                    color: controller.dot2Color.value,
                  ),
                ),
                Container(
                  width: 8.w,
                  height: 8.w,
                  decoration: BoxDecoration(
                    shape: BoxShape.circle,
                    color: controller.dot3Color.value,
                  ),
                ),
                Container(
                  width: 8.w,
                  height: 8.w,
                  decoration: BoxDecoration(
                    shape: BoxShape.circle,
                    color: controller.dot4Color.value,
                  ),
                ),
                Container(
                  width: 8.w,
                  height: 8.w,
                  decoration: BoxDecoration(
                    shape: BoxShape.circle,
                    color: controller.dot5Color.value,
                  ),
                ),
              ],
            )),
            Positioned(
              top: 0,
              bottom: 0,
              child: Obx(()=>Row(
                mainAxisAlignment : MainAxisAlignment.spaceBetween,
                children: [
                  Container(
                    width: (Get.width - 30.w - 30.w) / 4 ,
                    height: 1.w,
                    color: controller.line1Color.value,
                  ),
                  Container(
                    width: (Get.width - 30.w - 30.w) / 4 ,
                    height: 1.w,
                    color: controller.line2Color.value,
                  ),
                  Container(
                    width: (Get.width - 30.w - 30.w) / 4 ,
                    height: 1.w,
                    color: controller.line3Color.value,
                  ),
                  Container(
                    width: (Get.width - 30.w - 30.w) / 4 ,
                    height: 1.w,
                    color: controller.line4Color.value,
                  ),
                ],
              )),
            )
          ]),
          Stack(
            children: [
              Row(
                mainAxisAlignment : MainAxisAlignment.spaceBetween,
                children: [
                  Text('提交成功',style: text_grey_12),
                  Text('结清',style: text_grey_12)
                ],
              ),
              Row(
                mainAxisAlignment : MainAxisAlignment.spaceBetween,
                children: [
                  Text('审批',style: text_grey_12),
                  Text('签约',style: text_grey_12),
                  Text('放款',style: text_grey_12),
                ],
              ).marginSymmetric(horizontal: (Get.width - 30.w - 30.w)/4 - 8.w),
            ]
          ),
          Obx(() => Visibility(
            visible: !controller.hintBtn.value,
            child: SizedBox(
              width: Get.width-30.w-30.w,
              child: Column(
                mainAxisAlignment : MainAxisAlignment.end,
                crossAxisAlignment : CrossAxisAlignment.end,
                children: [
                  SizedBox(height: 15.w),
                  Obx(() => RawMaterialButton(
                    highlightColor: Colors.transparent, // 透明色
                    splashColor: Colors.transparent, // 透明色
                    elevation: 0,
                    fillColor:controller.hintBtnColor.value,
                    shape : RoundedRectangleBorder(borderRadius : BorderRadius.all(Radius.circular(6.w))),
                    // constraints: BoxConstraints.tightFor(width: 60.w, height: 30.w),
                    constraints: BoxConstraints.tightFor(height: 30.w),
                    child: Text(controller.hintBtnStr.value,style: text_white_12).marginSymmetric(horizontal: 10.w),
                    onPressed: ()=> controller.clickBtn(),
                  )),
                ],
              ),
            ),
          )),
          SizedBox(height: 15.w),
        ]
      ));
  }

  Widget buildBottomWidget(){
    return Container(
      width: Get.width - 30.w,
      margin: EdgeInsets.symmetric(horizontal: 15.w),
      padding: EdgeInsets.symmetric(horizontal: 15.w,vertical: 10.w),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(6.w),
        color: Color_white,
      ),
      child: Column(
        crossAxisAlignment : CrossAxisAlignment.start,
        children: [
          SizedBox(height: 9.w),
          Text('详细信息',style: text_131732_16b),
          SizedBox(height: 9.w),
          SizedBox(height: 6.w),
          Row(
            children: [
              Text('真实姓名：',style: text_grey_14),
              Obx(() => Text(controller.userName.value,style: text_131732_14)),
            ],
          ),
          SizedBox(height: 6.w),
          Row(
            children: [
              Text('手机号码：',style: text_grey_14),
              Obx(() => Text(controller.userPhone.value,style: text_131732_14)),
            ],
          ),
          SizedBox(height: 6.w),
          Row(
            children: [
              Text('申请时间：',style: text_grey_14),
              Obx(() => Text(controller.orderLoanTime.value,style: text_131732_14)),
            ],
          ),
          SizedBox(height: 6.w),
          Row(
            children: [
              Text('订单号码：',style: text_grey_14),
              Obx(() => Text(controller.orderLoanNum.value,style: text_131732_14)),
            ],
          ),
          SizedBox(height: 6.w)
        ]));
  }
}
